<template>
  <div class="game-swipe">
    <fs-swipe @change="handleChange">
      <fs-swipe-item v-for="(item, index) in props.gameList" :is-tran="true" :is-scale="true">
        <div class="game-swipe-item">
          <img :src="item.cover" />
        </div>
      </fs-swipe-item>
    </fs-swipe>
  </div>
</template>

<script setup lang="ts">
import FsSwipe from "@/components/FsSwipe/FsSwipe.vue";
import FsSwipeItem from "@/components/FsSwipe/FsSwipeItem.vue";
import type { IgameItem } from "@/types/gameType";

const props = defineProps<{
  gameList: IgameItem[];
}>();
const emit = defineEmits<{
  (e: "changeSwipe", game: IgameItem): void;
}>();

const handleChange = (index: number) => {
  emit("changeSwipe", props.gameList[index]);
};
</script>

<style scoped lang="scss">
.game-swipe {
  position: relative;
  width: 100%;
  height: 65%;
  z-index: 10;
  &-item {
    width: 100%;
    height: 100%;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 14px 18px rgba(0, 0, 0, 0.3);
    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }
}
</style>
